<%@page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<%
			String basepath = request.getContextPath();
		%>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link href="<%=basepath%>/css/account.css" rel="stylesheet" type="text/css" />
		<link href="<%=basepath%>/css/register.css" rel="stylesheet" type="text/css" />
		<script language="javascript" type="text/javascript" src="<%=basepath%>/js/include.js"></script>
		<script language="javascript" type="text/javascript" src="<%=basepath%>/js/register.js"></script>
		<script language="javascript" type="text/javascript" src="<%=basepath%>/js/common.js"></script>
		<script language="javascript" type="text/javascript" src="<%=basepath%>/js/utilTool.js"></script>
		<script language="javascript" type="text/javascript" src="<%=basepath%>/js/validatorTool.js"></script>
<style type="text/css">
.mycolor {
	color: #FF0000;
}
</style>
	</head>
	<body class="fullbody">
		<div id="content" class="content">
			<div class="">
				<b class="rtop"><b class="r1"></b><b class="r2"></b><b
					class="r3"></b><b class="r4"> </b> </b>
				<table cellpadding="0" cellspacing="0" border="0" width="980">
					<tr>
						<td class="leftmargin"></td>
						<td valign="top" align="left">
							<form method="post"  id="supProdInfoForm">
								<table cellpadding="0" cellspacing="0" border="0" width="920">
									<tr class="subTitle">
										<td colspan="2" >产品分类<span class="needfill">*</span></td>
										<td align="right">
											<input type="button" value="增加产品分类" onclick="addProdClInfo()" class="btnlcs"/>
										</td>
									</tr>
									<tr>
										<td colspan="3" align="center">
											<table cellpadding="1" cellspacing="0" id="prodCl"
												class="subpage_table1 withborder2"  align="center" width="800">
												<tr >
													<th width="30">序号</th>
													<th width="100">产品分类名称</th>
													<th width="100" >产品用途</th>
													<th width="100" >产能（年）</th>
													<th width="100" >主要材料来源</th>
													<th width="100" >供货周期</th>
													<th width="205" >备注（请补充注明：市场占有率、主要客户级业绩、可供余量、主要设备、可信竞争力</th>
													<th width="65">操作</th>
												</tr>
												<c:if test="${currentInfo!=null && currentInfo.infoProVOs!=null}">
													<c:forEach items="${currentInfo.infoProVOs}" var="prodCl" varStatus="index">
														<tr align="center"  id="prodClRow${prodCl.index}">
															<td><input type="text" class="list_text_2"  name="prodClindex" value="${prodCl.index}" readOnly/></td>
															<td>
																<input type="text" class="list_text_2"  name="prodClname" value="${prodCl.name}" id="prodCl${prodCl.index}name" 
																	onclick="initProdClList('prodCl${prodCl.index}')" readOnly/></td>
															<td>
																<input type="text" class="list_text_2"  name="prod_app"  value="${prodCl.prod_app}"/>
															</td>
															<td>
																<input type="text" class="list_text_2"  name="prod_output" value="${prodCl.prod_output}"/>
															</td>
															<td>
																<input type="text" class="list_text_2"  name="prod_material" value="${prodCl.prod_material}"/>
															</td>
															<td>
																<input type="text" class="list_text_2"  name="prod_cycle" value="${prodCl.prod_cycle}"/>
															</td>
															<td>
																<input type="text" class="list_text_2"  name="prod_memo" value="${prodCl.prod_memo}"/>
															</td>
															<td>
																<a id="row${prodCl.index}" href="javascript:deleteProdClRow('${prodCl.index}')" class="linkstyle3">删除</a>
																<input type="hidden" name="pk_supcheckprod" value="${prodCl.pk_supcheckprod}"  />
																<input type="hidden" name="pkProdCl" id="prodCl${prodCl.index}" value="${prodCl.pkProdCl}"  />
															</td>
														</tr>
													</c:forEach>
												</c:if>
											</table>
										</td>
									</tr>
								</table>
								<br />
								<br />
								<table cellpadding="0" cellspacing="0" border="0" width="920">
									<tr class="subTitle">
										<td colspan="2">资质分类 </td>
										<td width="30"></td>
										<td align="right"> 
											<input type="button" value="增加资质分类" onclick="addQaClInfo()" class="btnlcs"/>
										</td>
									</tr>
									<tr>
										<td colspan="4" align="center">
											<table cellpadding="1" cellspacing="0" id="qaCl"
												class="subpage_table1 withborder2"  width="800">
												<tr >
													<th width="30">序号</th>
													<th width="670">专业资质分类名称</th>
													<th width="100">操作</th>
												</tr>
												<c:if test="${currentInfo!=null && currentInfo.infoQaVos!=null}">
													<c:forEach items="${currentInfo.infoQaVos}" var="qaCl" varStatus="index">
														<tr align="center"  id="qaClRow${qaCl.index}">
															<td><input type="text" class="list_text_2"   name="qaClindex" value="${qaCl.index}" readOnly/></td>
															<td>
																<input type="text" class="list_text_2"   name="name" value="${qaCl.name}" id="qacl${qaCl.index}name" 
																	onclick="initQaClList('qacl${qaCl.index}')" readOnly/></td>
															<td>
																<a id="row${qaCl.index}" href="javascript:deleteQaClRow('${qaCl.index}')" class="linkstyle3">删除</a>
																<input type="hidden" name="pk_qacode" value="${qaCl.pk_qacode}" id="qacl${qaCl.index}" />
																<input type="hidden" name="pk_supcheckqa" value="${qaCl.pk_supcheckqa}" />
															</td>
														</tr>
													</c:forEach>
												</c:if>
											</table>
										</td>
									</tr>
								</table>
								<br />
								<br />
								<table cellpadding="1" cellspacing="0" border="0" width="920">
									<tr class="subTitle">
										<td colspan="5">资质分类附件</td>
									</tr>
									<tr>
										<td colspan="4" align="center">
											<table  width="800">
												<tr>
													<td class="memoFont">注：上传的资质文件内容包括但不限于：最新经过年检的营业执照、税务登记证、组织机构代码证、特殊行业资质证（有效期年限内），体系认证的资质证，财务报表，如是代理企业，需提供代理授权书。</td>
												</tr>
												<tr>
													<td/>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td colspan="4" align="center">
											<table cellpadding="1" cellspacing="0"  width="800" class="subpage_table1 withborder2"  id="qaFile">
												<tr>
													<th width="200">附件名称</th>
													<th width="365">附件内容说明</th>
													<th width="140">上传附件</th>
													<th width="130">上传时间</th>
													<th width="65">操作</th>
												</tr> 
												<c:if test="${currentInfo!=null && currentInfo.infoCheckFileItemVos!=null}">
													<c:forEach items="${currentInfo.infoCheckFileItemVos}" var="file" varStatus="index">
														<tr  id="${file.pkFile}">
															<td ><input name="fileAlias"  class="list_text_2"   type="text"  value="${file.fileAlias}" /></td>
															<td><input name="fileMemo"   class="list_text_2"    type="text" value="${file.fileMemo}" /></td>
															<td style="font-size:12px;"> ${file.fileName} </td>
															<td style="font-size:12px;"> ${file.creatDate} </td>
															<td>
																<a id="delbtn_${file.pkFile}"  href="javascript:delFile('${file.pkFile}')" class="linkstyle3">删除</a>
																<input name="pk_supinfocheck_h" type="hidden" value="${file.pk_supinfocheck_h}" />
																<input name="pk_supinfocheck_file_b" type="hidden" value="${file.pk_supinfocheck_file_b}" />
																<input name="pkFile" type="hidden" value="${file.pkFile}" />
															</td>
														</tr>
													</c:forEach>
												</c:if>
											</table>
											<input type="hidden" name="pk_file" value=""/>
										</td>
									</tr>
									<tr>
										<td colspan="4">
											&nbsp;				 
										</td>
									</tr>
									<tr class="buttonrow">
										<td align="center" colspan="5">
											<input type="button" value="上传附件" onclick="upLoadFile();" class="btnscs" />
											&nbsp;&nbsp;
											<input type="button" value="暂存" onclick="save();" class="btnscs" />
											&nbsp;&nbsp;
											<input type="button" value="上一步" onclick="preStep();" class="btnscs" />
											&nbsp;&nbsp;
											<input type="button" value="提交审核" onclick="commit();" class="btnscs" />
										</td>
									</tr>
								</table>
							</form>
						</td>
					</tr>
				</table>
				<div id="message" class="mycolor">
					<c:out value="${ERROR_MESSAGE}"></c:out>
				</div>
				<b class="rbottom">
					<b class="r4"></b>
					<b class="r3"></b>
					<b class="r2"></b>
					<b class="r1"> </b> 
				</b>
			</div>
		</div>
<script type="text/javascript">
//上一步
function preStep() {
	//var valid = checkSupInfo(5);
	//if(valid ==false){
	//	return false;
	//}
	document.forms[0].action = "<%=basepath %>/register/invitePreStep?preStep=4";
	document.forms[0].submit();
		
}
//保存
function save(){
	//var valid = checkSupInfo(6);
	//if(valid ==false){
	//	return false;
	//}
	document.forms[0].action = "<%=basepath %>/register/inviteSaveSupInfo?step=5";
	document.forms[0].submit();
}
/**
 *提交审核
 */
function commit(){
	//var valid = checkSupInfo(6);
	//if(valid ==false){
	//	return false;
	//}
	document.forms[0].action = "<%=basepath %>/register/inviteCmtSupInfo";
	document.forms[0].submit();
}


var prodClIndex=${prodClRows};
function addProdClInfo() {
	var prodCl = document.all("prodCl");
	var rowIndex = prodCl.rows.length;
	
	if(prodCl != null) {
 		var row = prodCl.insertRow();
 		prodClIndex++;
	 	row.style.height = '26px';
	 	row.id = "prodClRow"+prodClIndex;

		//序号
		var cell = row.insertCell()
		cell.innerHTML = "<input type='text' class='list_text_2' style='width:100%' name='prodClindex' value='"+rowIndex+"'  readOnly/>";

 		//产品分类名称
 		var cellId="prodCl"+prodClIndex;
 		var cellName=cellId+"name";
 		cell = row.insertCell();
 		cell.align = 'center';
 		cell.innerHTML = "<input type='text' class='list_text_2' style='width:100%' name='prodClname' id='"+cellName+"' onclick=\"initProdClList('"+cellId+"')\" readOnly />";

		//用途
 		cell = row.insertCell();
 		cell.align = 'center';
 		cell.innerHTML ="<input type='text'  class='list_text_2' style='width:100%' name='prod_app'/>";
 		//产能
 		cell = row.insertCell();
 		cell.align = 'center';
 		cell.innerHTML ="<input type='text'  class='list_text_2' style='width:100%'  name='prod_output'/>";
 		//原料
 		cell = row.insertCell();
 		cell.align = 'center';
 		cell.innerHTML ="<input type='text'  class='list_text_2' style='width:100%'  name='prod_material'/>";
 		//年
 		cell = row.insertCell();
 		cell.align = 'center';
 		cell.innerHTML ="<input type='text'  class='list_text_2' style='width:100%'  name='prod_cycle'/>";
 		//备注
 		cell = row.insertCell();
 		cell.align = 'center';
 		cell.innerHTML ="<input type='text'  class='list_text_2' style='width:100%'  name='prod_memo'/>";
 		
 		//删除操作
 		//var cellId="bankType"+prodClIndex;
 		//var cellName=cellId+"name";
 		cell = row.insertCell();
 		cell.align = 'center';   
 		cell.innerHTML = "<a id='row"+prodClIndex+"' href=\"javascript:deleteProdClRow('"+prodClIndex+"')\" class='linkstyle3'>删除</a><input type='hidden' name='pkProdCl' id='"+cellId+"'/><input type='hidden' name='pk_supcheckprod' />";
 	}
}
//删除行
function deleteProdClRow(index) {
	var root = document.all("prodCl");
	var row = "prodClRow"+index ;
	var rows = root.rows;
	//var deletepos = 1;
	//寻找到对应的删除行并进行删除
	for(var pos = 1; pos < rows.length; pos++) {
		var temprow = rows[pos];
		if(temprow.id == row) {
			root.deleteRow(pos);
			break;
		}
	}
	//当删除行操作时更新显示索引
	for(var pos = 1; pos < rows.length; pos++) {
		var temprow = rows[pos];
		var cells = temprow.cells;
		var cell = cells[0];
		if(typeof(cell) == 'object') {
			cell.innerHTML = "<input type='text' class='list_text_2' style='width:95%' name='prodClindex' value='"+pos+"'  readOnly/>";
		}
	}	
}

//行号
var qaClIndex=${qaClRows};

function addQaClInfo() {
	var qaCl = document.all("qaCl");
	var rowIndex = qaCl.rows.length;
	
	if(qaCl != null) {
 		var row = qaCl.insertRow();
 		qaClIndex++;
	 	row.style.height = '26px';
	 	row.id = "qaClRow"+qaClIndex;

		//序号
		var cell = row.insertCell()
		cell.innerHTML = "<input type='text' class='list_text_2'  name='qaClindex' value='"+rowIndex+"'  readOnly/>";

 		//资质分类名称
 		var cellId="bankType"+qaClIndex;
 		var cellName=cellId+"name";
 		cell = row.insertCell();
 		cell.align = 'center';
 		cell.innerHTML = "<input type='text' class='list_text_2'  name='name' id='"+cellName+"' onclick=\"initQaClList('"+cellId+"')\" readOnly />";

 		//删除操作
 	//	var cellId="bankType"+qaClIndex;
 		// var cellName=cellId+"name";
 		cell = row.insertCell();
 		cell.align = 'center';   
 		cell.innerHTML = "<a id='row"+qaClIndex+"' href=\"javascript:deleteQaClRow('"+qaClIndex+"')\" class='linkstyle3'>删除</a><input type='hidden' name='pk_qacode' id='"+cellId+"'/><input type='hidden' name='pk_supcheckqa' />";
 	}
}
//删除行
function deleteQaClRow(index) {
	var root = document.all("qaCl");
	var row = "qaClRow"+index ;
	var rows = root.rows;
	//var deletepos = 1;
	//寻找到对应的删除行并进行删除
	for(var pos = 1; pos < rows.length; pos++) {
		var temprow = rows[pos];
		if(temprow.id == row) {
			root.deleteRow(pos);
			break;
		}
	}
	//当删除行操作时更新显示索引
	for(var pos = 1; pos < rows.length; pos++) {
		var temprow = rows[pos];
		var cells = temprow.cells;
		var cell = cells[0];
		if(typeof(cell) == 'object') {
			cell.innerHTML = "<input type='text' class='list_text_2'  name='qaClindex' value='"+pos+"'  readOnly/>";
		}
	}	
}

function initProdClList(id){
	var url = "iframe:<%=basepath%>/register/initProdClList?id="+id;
	dialog("", url,"500", "400", "","");
}

function initQaClList(id){
	var url = "iframe:<%=basepath%>/register/initQaClList?id="+id;
	dialog("", url,"500", "400", "","");
}

function upLoadFile(){
	var url = "<%=basepath%>/sourcingcoll/fileupload.jsp";
	url = url + "?" + "uploadMode=7";
	window.open(url,'' ,'width=640,height=330,location=no');
}

//刷新页面
function refreshPage(){
	document.forms[0].action ="<%=basepath %>/register/inviteSaveSupInfo?step=6";
	document.forms[0].submit();
}

function delFile(index){
	var fileList = document.getElementById("qaFile");
	if (fileList != null) {
		// 获取报价信息有多少行
		var rows = fileList.rows;
		if (rows != null && rows.length > 0) {
			for ( var pos = 0; pos < rows.length; pos++) {
				var row = rows[pos];
				// 寻找要删除的row
				if (row.id == index) {
					fileList.deleteRow(pos);
					deleteFile(index);
					break;
				}
			}
		}
	}
}

//需要处理删除失败
function deleteFile(pk_file){  
	document.forms[0].pk_file.value = pk_file;
	document.forms[0].action="<%=basepath%>/ebvpfile/deletefile";
	//提交表单
	var options3 = {
		beforeSubmit : showRequest3, 
		success : showResponse3
	};
	$("#supProdInfoForm").ajaxSubmit(options3);
}

function showRequest3(formData, jqForm, options) {
}

function showResponse3(responseText, statusText, xhr, $form) {
}
</script>
	</body>